package com.netty.serializer;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
@Qualifier("JSONSerializer")
public class JSONSerializer implements Serializer{



    @Override
    public byte[] serialize(Object object) {

        return JSON.toJSONBytes(object);

    }



    @Override
    public <T> T deserialize(Class<T> clazz, byte[] bytes) {

        return JSON.parseObject(bytes, clazz);

    }

}

